﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace DotNETX.Utility
{
    public static class ProgramUtils
    {
        public static void CHANGE_PRIVATE_BINPATH(string dirs = "Castle;Core;Module;UI;Misc;")
        {
            AppDomain.CurrentDomain.SetData("PRIVATE_BINPATH", dirs);

            AppDomain.CurrentDomain.SetData("BINPATH_PROBE_ONLY", dirs);

            var m = typeof(AppDomainSetup).GetMethod("UpdateContextProperty", BindingFlags.NonPublic | BindingFlags.Static);

            var funsion = typeof(AppDomain).GetMethod("GetFusionContext", BindingFlags.NonPublic | BindingFlags.Instance);

            m.Invoke(null, new object[] { funsion.Invoke(AppDomain.CurrentDomain, null), "PRIVATE_BINPATH", dirs });

        }

        //static ProgramUtils()
        //{
        //    CHANGE_PRIVATE_BINPATH();
        //}
    }
}
